let price = 5;
let quantity = 2;
let total = 0;

let dep = new Set();
const effect = () => total = price * quantity;

track();
effect();

console.log('total:', total);
quantity = 3;
console.log('total:', total);
trigger();
console.log('total:', total);

function track() { dep.add(effect) }

function trigger() { dep.forEach(effect => effect()) }
